﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace FirstGame
{
    public class InputSystem
    {
        private MouseState _CurrentMouseState;

        public MouseState CurrentMouseState
        {
            get { return _CurrentMouseState; }
            set { _CurrentMouseState = value; }
        }
        private MouseState _LastMouseState;

        public MouseState LastMouseState
        {
            get { return _LastMouseState; }
            set { _LastMouseState = value; }
        }

        private Vector2 _CurPoint;

        public Vector2 CurPoint
        {
            get { return _CurPoint; }
            set { _CurPoint = value; }
        }

           

       

        public void Update()
        {
            _LastMouseState = _CurrentMouseState;
            _CurrentMouseState = Mouse.GetState();
            CurPoint = new Vector2(_CurrentMouseState.X, _CurrentMouseState.Y);
            
        }

        public bool IsNewMouseClick(ButtonState state)
        {
            return (_CurrentMouseState.LeftButton == state
                && _LastMouseState.LeftButton == ButtonState.Released);
        }
    }
}
